<template>
  <div class="container">
    <h4>{{ goodsInfo.title }}</h4>
    <hr />
    <div class="desc" v-html="goodsInfo.content"></div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 商品图文详情
      goodsInfo: {}
    }
  },
  created() {
    this.getDesc()
  },
  methods: {
    // 获取商品图文详情
    async getDesc() {
      const { data: res } = await this.$http.get(
        '/api/goods/getdesc/' + this.$route.params.id
      )
      if (res.status !== 0) {
        return this.$toast('服务器异常!')
      }
      this.goodsInfo = res.message[0]
    }
  }
}
</script>

<style lang="less" scoped>
h4 {
  font-size: 16px;
  color: #226aff;
  text-align: center;
  margin: 15px 0;
}
.desc {
  padding: 0 5px;
}
</style>
